package com.tanhua.server.controller;

import com.tanhua.server.service.TodayBestService;
import com.tanhua.common.utils.Cache;
import com.tanhua.server.vo.PageParams;
import com.tanhua.server.vo.PageResult;
import com.tanhua.server.vo.TodayBest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("tanhua")
public class TodayBestController {

    @Autowired
    private TodayBestService todayBestService;

    /*
        今日佳人
     */
    @GetMapping("todayBest")
    public ResponseEntity todayBest(@RequestHeader("Authorization") String token) {

        TodayBest todayBest = todayBestService.todayBest(token);

        return ResponseEntity.ok(todayBest);
    }

    /*
        推荐佳人
     */
    @GetMapping("recommendation")
    @Cache(time = "30")
    public ResponseEntity recommendation(@RequestHeader("Authorization") String token, PageParams pageParams) {

        PageResult result = todayBestService.recommendation(token, pageParams);

        return ResponseEntity.ok(result);
    }
}
